import { fileURLToPath, URL } from "node:url";

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
// import vueJsx from '@vitejs/plugin-vue-jsx'
import vueDevTools from "vite-plugin-vue-devtools";
import qiankun from "vite-plugin-qiankun";
// https://vite.dev/config/
export default defineConfig({
  base: "http://172.20.10.5:8082/",
  server: {
    host: "172.20.10.5",

    port: 8082,
    cors: true,
    headers: {
      "Access-Control-Allow-Origin": "*", // 主应用获取子应用时跨域响应头
    },
  },
  plugins: [
    vue(),
    qiankun("administration", {
      useDevMode: true,
    }),
  ],
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url)),
    },
  },
  build: {
    rollupOptions: {
      output: {
        format: "umd",
        name: "administration", // 与 window.ReactApp 一致
        entryFileNames: "[name].umd.js",
      },
    },
  },
});
